from openpyxl import load_workbook


def readexcel(filepath, sheet):
    wb = load_workbook(filepath)  # 打开某个excel文件
    sheet = wb[sheet]  # 也可以获取默认表单    wb.active
    rows = list(sheet.values)  # 获取单元格的值sheet.cell(0,0)

    """获取excel中的数据，最终转换成dict形式"""
    title = rows[0]
    row = rows[1:]
    data = [dict(zip(title, r)) for r in row]
    return data
